package com.hiof.customviews;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import com.hiof.beans.RouteInfo;
import com.hiof.beans.TypeOfRouteStatus;

import java.util.List;

/**
 * Created by IntelliJ IDEA.
 * User: manish
 * Date: 3/30/12
 * Time: 9:11 PM
 * To change this template use File | Settings | File Templates.
 */
public class CustomRaceRouteArrayAdapter extends ArrayAdapter {
     private static final int CURRENT_RACE_COLOR = 0xFF3366CC;
             //0xFFA2CCF2;
    List<RouteInfo> routeInfos;
    public CustomRaceRouteArrayAdapter(Context context, int textViewResourceId, List<RouteInfo> routeInfos) {
        super(context, textViewResourceId, routeInfos);
        this.routeInfos = routeInfos;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        View view = super.getView(position,convertView,parent);
        if(null!=view){
            if(routeInfos.get(position).getStatus()== TypeOfRouteStatus.ONGOING){
                view.setBackgroundColor(CURRENT_RACE_COLOR);
            }
        }
        return view;
    }
}

